var mysql      = require('mysql');
var connection = mysql.createConnection({
  host     : 'localhost', // localhost  192.168.31.145
  user     : 'root',
//   port     : '3306',
  password : '123456',
  database : 'test'
});
 
connection.connect();
 console.log('connect')
connection.query('SELECT 1 + 1 AS solution', function (error, results, fields) {
  if (error) throw error;
  console.log('The solution is: ', results[0].solution);
});


var  sql = 'SELECT * FROM websites';
//查
connection.query(sql,function (err, result) {
        if(err){
          console.log('[SELECT ERROR] - ',err.message);
          return;
        }
 
       console.log('--------------------------SELECT----------------------------');
       console.log(result);
       console.log('------------------------------------------------------------\n\n');  
});
 
 connection.end();